//引入中间件
const jwt = require('jwt-simple')

const adminName = 'admin'
const secreat = '666' //加盐

const token = jwt.encode({
  adminName: adminName,
  //token有效时间(秒)
  exp: Date.now() / 1000 +5,
}, secreat)

console.log(token, 'token');

//对token解码
const tokenResult = jwt.decode(token, secreat)

console.log(tokenResult);